<template>
  <div class="app-container">
    <!-- 查询表单 -->
    <el-form
      label-width="94px"
      :style="{ '--theme': $store.getters.themeColor }"
    >
      <el-row>
        <el-row class="page-in">
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="事件编号">
                <el-input
                  v-model="qryParams.orderId"
                  placeholder="请输入"
                  clearable
                ></el-input>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col class="input clear-icon" id="alarmTime">
              <el-form-item label="告警时间">
                <el-date-picker
                  prefix-icon="el-icon-date"
                  :editable="false"
                  class="timeClass"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  :picker-options="pickerOptions"
                  @focus="setPickerOptions"
                  v-model="qryParams.warnTime"
                  type="datetimerange"
                  clear-icon="el-icon-circle-close"
                  popper-class="warnTime"
                  :default-time="['00:00:00', '23:59:59']"
                  range-separator="至"
                  start-placeholder="开始时间"
                  end-placeholder="结束时间"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="事发区域">
                <el-cascader
                  v-model="qryParams.area"
                  :options="selectDataSource.areaOptions"
                  clearable
                  placeholder="请选择"
                  :show-all-levels="true"
                  :props="{ checkStrictly: true }"
                  @expand-change="areaExpandChangeFun"
                  @change="areaChangeFun"
                ></el-cascader>
              </el-form-item>
            </el-col>
          </el-col>
        </el-row>
        <el-row class="page-in">
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="告警类型">
                <el-select
                  v-model="qryParams.eventType"
                  placeholder="请选择"
                  collapse-tags
                  size="small"
                  clearable
                  filterable
                  multiple
                >
                  <el-option
                    v-for="(item, index) in selectDataSource.eventTypeList"
                    :key="index"
                    :value="item.typeValue"
                    :label="item.typeName"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="摄像机编号">
                <el-input
                  v-model="qryParams.deviceCode"
                  placeholder="请输入"
                  clearable
                ></el-input>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="摄像机名称">
                <el-select
                  v-model="qryParams.deviceCode2"
                  placeholder="请输入"
                  size="small"
                  clearable
                  filterable
                  default-first-option
                  remote
                  @visible-change="clearDevice"
                  :remote-method="getDevice"
                  no-data-text="无匹配数据"
                >
                  <el-option
                    v-for="(item, index) in selectDataSource.DeviceList"
                    :key="index"
                    :value="item.deviceCode"
                    :label="item.devName"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
        </el-row>
        <el-row
          class="page-in"
          style="display: flex; flex-wrap: wrap"
          v-if="!this.showButton"
        >
          <el-col :span="8">
            <el-form-item label="物联设备编号">
              <el-input
                v-model.trim="qryParams.iotDeviceCode"
                placeholder="请输入"
                clearable
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="物联设备名称">
              <el-select
                v-model.trim="qryParams.iotDeviceCode2"
                placeholder="请输入"
                size="small"
                clearable
                filterable
                default-first-option
                remote
                :remote-method="getIotDevice"
                no-data-text="无匹配数据"
              >
                <el-option
                  v-for="(item, index) in selectDataSource.iotDeviceList"
                  :key="index"
                  :value="item.deviceCode"
                  :label="item.deviceName"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="8">
            <el-col class="input">
              <el-form-item label="事件等级">
                <el-select
                  v-model="qryParams.eventLevel"
                  placeholder="事件等级"
                  size="small"
                  clearable
                >
                  <el-option
                    v-for="(item, index) in selectDataSource.eventLevelList"
                    :key="index"
                    :label="item.dictLabel"
                    :value="item.dictValue"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col> -->
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="事件状态">
                <el-select
                  v-model="qryParams.eventState"
                  placeholder="请选择"
                  collapse-tags
                  size="small"
                  clearable
                  filterable
                  multiple
                >
                  <!--              <el-option label="全部" value=""></el-option>-->
                  <el-option
                    v-for="(item, index) in selectDataSource.eventStateList"
                    :key="index"
                    :label="item.dictLabel"
                    :value="item.dictValue"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="重要等级">
                <el-select
                  v-model="qryParams.importanceLevel"
                  placeholder="请选择"
                  size="small"
                  clearable
                >
                  <el-option
                    v-for="(
                      item, index
                    ) in selectDataSource.importanceLevelList"
                    :key="index"
                    :label="item.dictLabel"
                    :value="item.dictValue"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="事件标题">
                <el-input
                  v-model="qryParams.eventTitle"
                  placeholder="请输入"
                  clearable
                ></el-input>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="告警来源">
                <el-select
                  v-model="qryParams.eventSourse"
                  placeholder="请选择"
                  size="small"
                  clearable
                >
                  <el-option
                    v-for="(item, index) in selectDataSource.eventSourceList"
                    :key="index"
                    :value="item.dictValue"
                    :label="item.dictLabel"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="是否二次研判">
                <el-select
                  v-model="qryParams.isSecondJudge"
                  placeholder="请选择"
                  size="small"
                  clearable
                >
                  <el-option label="是" value="1"></el-option>
                  <el-option label="否" value="0"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="qryParams.isSecondJudge == '1'">
            <el-col class="input">
              <el-form-item label="二次研判结果">
                <el-select
                  v-model="qryParams.secondJudgeResult"
                  @change="changeSecondJudgeResult"
                  placeholder="请选择"
                  size="small"
                  clearable
                >
                  <el-option label="真" value="1"></el-option>
                  <el-option label="假" value="0"></el-option>
                  <el-option label="算法未分析" value="2"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否二次识别">
              <el-select
                v-model="qryParams.isSecondIdentify"
                placeholder="请选择"
                size="small"
                @change="qryParams.secondIdentifyResult = null"
                clearable
                filterable
              >
                <el-option label="是" value="1"></el-option>
                <el-option label="否" value="0"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="qryParams.isSecondIdentify == '1'">
            <el-form-item label="二次识别结果">
              <el-select
                v-model="qryParams.secondIdentifyResult"
                @change="changeSecondJudgeResult"
                placeholder="请选择"
                size="small"
                clearable
              >
                <el-option label="真" value="1"></el-option>
                <el-option label="假" value="0"></el-option>
                <el-option label="算法未分析" value="2"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="摄像机厂家">
                <el-select
                  v-model="qryParams.modelId"
                  placeholder="请选择"
                  clearable
                >
                  <el-option
                    v-for="(item, index) in selectDataSource.videofactoryList"
                    :key="index"
                    :label="item.dictLabel"
                    :value="item.dictValue"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col class="input">
              <!--              <el-form-item label="置信度">-->
              <!--                <el-input class="no-tips" v-model="qryParams.confidenceLevel" placeholder="请输入"-->
              <!--                  @input="verifyConfidenceLevel" @keydown.native="channelInputLimit" type="number" clearable></el-input>-->
              <!--              </el-form-item>-->
              <div class="confidenceLevel">
                <el-form-item label="置信度">
                  <div
                    class="input-wrapper"
                    :style="
                      checkConfidenceLevel() ? '' : 'border:1px solid #FF6A6C'
                    "
                  >
                    <div class="bor">
                      <el-input
                        v-model="qryParams.confidenceLevelMin"
                        @input="
                          verifyConfidenceLevel($event, 'confidenceLevelMin')
                        "
                        placeholder="请输入"
                      ></el-input>
                    </div>
                    <div class="bor zhixindu-select">
                      <el-select v-model="qryParams.minChar">
                        <el-option
                          v-for="item in confidenceLevelSelectData"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                        ></el-option>
                      </el-select>
                    </div>
                    <div class="bor center-text">置信度</div>
                    <div class="bor zhixindu-select">
                      <el-select v-model="qryParams.maxChar">
                        <el-option
                          v-for="item in confidenceLevelSelectData"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                        ></el-option>
                      </el-select>
                    </div>
                    <div class="bor bor-none">
                      <el-input
                        v-model="qryParams.confidenceLevelMax"
                        @input="
                          verifyConfidenceLevel($event, 'confidenceLevelMax')
                        "
                        placeholder="请输入"
                      ></el-input>
                    </div>
                    <div
                      class="tips"
                      v-if="!checkConfidenceLevel()"
                      title="“最小值、最大值”需至少填写一项，且最小值需要小于等于最大值"
                    >
                      “最小值、最大值”需至少填写一项，且最小值需要小于等于最大值
                    </div>
                  </div>
                </el-form-item>
              </div>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="userIdIsShow">
            <el-col class="input" id="findtenantId">
              <el-form-item label="客户名称/ID">
                <el-select
                  v-model="tenantkeyword"
                  filterable
                  remote
                  reserve-keyword
                  placeholder="请输入"
                  :remote-method="searchTenant"
                  :loading="loading"
                  @change="tenantChange"
                  size="medium"
                  @clear="tenantList = []"
                  clearable
                >
                  <el-option
                    v-for="(item, index) in tenantList"
                    :key="index"
                    :label="item.tenantName"
                    :value="item.tenantId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="是否超期">
                <el-select
                  v-model="qryParams.ifTimeOut"
                  placeholder="请选择"
                  size="small"
                  clearable
                >
                  <el-option label="是" value="1"></el-option>
                  <el-option label="否" value="2"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col class="input">
              <el-form-item label="研判结果">
                <el-select
                  v-model="qryParams.judgeResult"
                  placeholder="请选择"
                  size="small"
                  clearable
                >
                  <el-option label="真警" value="1"></el-option>
                  <el-option label="误报" value="0"></el-option>
                  <el-option label="重复告警" value="2"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="!userIdIsShow">
            <el-col class="input">
              <el-form-item label="组织名称">
                <el-cascader
                  :show-all-levels="false"
                  style="font-size: 14px"
                  v-model="qryParams.orgIds"
                  placeholder="请选择"
                  collapse-tags
                  filterable
                  :options="orgTreeData"
                  :props="orgTreeProp"
                  clearable
                ></el-cascader>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="userIdIsShow">
            <el-col class="input">
              <el-form-item label="组织名称">
                <el-cascader
                  :show-all-levels="false"
                  style="font-size: 14px"
                  v-model="qryParams.areaIds"
                  placeholder="请选择"
                  collapse-tags
                  filterable
                  :options="orgTreeData"
                  :props="orgTreeProp"
                  clearable
                  ref="orgName"
                  @change="handleCascaderChange"
                ></el-cascader>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="!userIdIsShow">
            <el-col class="input">
              <el-form-item label="摄像机标签">
                <KeyHighSelect
                  v-model="qryParams.deviceLabelId"
                  :dataList="selectDataSource.deviceLabelList"
                  size="small"
                  :collapseTags="true"
                  :filterable="true"
                  :multiple="true"
                  :clearable="true"
                  placeholder="请选择"
                  labelName="labelName"
                  valueName="labelId"
                ></KeyHighSelect>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="!userIdIsShow">
            <el-form-item label="告警类型标签">
              <KeyHighSelect
                v-model="qryParams.tagIdList"
                :dataList="tagList"
                size="small"
                :collapseTags="true"
                :filterable="true"
                :multiple="true"
                :clearable="true"
                placeholder="请选择"
                labelName="tagName"
                valueName="tagId"
              ></KeyHighSelect>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="!userIdIsShow">
            <el-form-item label="告警标签">
              <el-select
                v-model="qryParams.alarmTagIdsList"
                placeholder="请选择"
                size="small"
                collapse-tags
                clearable
                filterable
                multiple
              >
                <el-option
                  v-for="(item, index) in alarmTags"
                  :key="index"
                  :value="item.lableId"
                  :label="item.lableName"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="userIdIsShow">
            <el-form-item label="是否3D放大">
              <el-select
                v-model="qryParams.enlargeFlag"
                placeholder="请选择"
                size="small"
                clearable
              >
                <el-option
                  v-for="(item, index) in largeBy3DList"
                  :key="index"
                  :value="item.value"
                  :label="item.name"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="!userIdIsShow">
            <el-form-item label="告警原因">
              <KeyHighSelect
                v-model="qryParams.alarmReasonList"
                :dataList="alarmCauseList"
                size="small"
                :collapseTags="true"
                :filterable="true"
                :multiple="true"
                :clearable="true"
                placeholder="请选择"
                labelName="reason"
                valueName="reason"
              ></KeyHighSelect>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="page-in">
          <el-row>
            <el-col :span="12" class="default-button-width">
              <el-button
                v-hasPermi="['event:alarm:export']"
                @click="leaderExport()"
                size="small"
                icon="el-icon-upload2"
              >
                导出
              </el-button>
              <el-button
                title="下载告警图片"
                v-hasPermi="['event:myevent:downImg']"
                style="margin-left: 12px"
                @click="downAlarmImg"
              >
                <span class="icon-a-05xiazaitupian iconfont"></span>
                下载告警图片</el-button
              >
              <el-button
                style="margin-left: 12px"
                :title="'自定义列'"
                v-hasPermi="['event:myevent:customList']"
                @click="handleColumn"
                v-if="isShowView === 2"
              >
                <i
                  class="iconfont icon-zidingyilietubiao"
                  style="font-size: 14px"
                ></i>
                自定义列</el-button
              >
            </el-col>
            <el-col
              :span="12"
              class="input default-button-width"
              style="text-align: right"
            >
              <el-button
                type="primary"
                size="small"
                style="margin-right: 12px"
                icon="el-icon-search"
                @click="queryEventData()"
                v-hasPermi="['event:myevent:query']"
                ><span>查询</span></el-button
              >
              <el-button
                icon="el-icon-refresh-right"
                size="small"
                style="margin-right: 12px"
                @click="resetFormData()"
                v-hasPermi="['event:myevent:reset']"
                ><span>重置</span></el-button
              >
              <el-button
                v-hasPermi="['event:myevent:openclose']"
                size="small"
                :icon="showButton ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
                @click="showSelect()"
              >
                <span>{{ showButton ? "展开" : "收起" }}</span></el-button
              >
            </el-col>
          </el-row>
        </el-row>
      </el-row>
      <hr class="custom-hr" />
      <el-row style="margin: 0px 0px 18px">
        <div
          v-hasPermi="['event:myevent:showlist']"
          class="data-view-btn showList iconfont icon-caidanguanli"
          @click="viewClick(2)"
          style="text-align: center; font-size: 22px"
          :style="{ color: treeTypeChoose == 2 ? '#2C2F33' : '#ffffff' }"
          :class="
            treeTypeChoose == 1 ? 'eventSelectClass' : 'eventUnSelectClass'
          "
          :title="'列表视图'"
        ></div>
        <div
          v-hasPermi="['event:myevent:showview']"
          class="data-view-btn showView iconfont icon-more"
          style="text-align: center; font-size: 22px"
          @click="viewClick(1)"
          :style="{ color: treeTypeChoose == 1 ? '#2C2F33' : '#ffffff' }"
          :class="
            treeTypeChoose == 2 ? 'eventSelectClass' : 'eventUnSelectClass'
          "
          :title="'看板视图'"
        ></div>
      </el-row>
      <el-row :gutter="10">
        <!-- 看板视图 -->
        <div v-if="isShowView === 1">
          <div style="display: flex; flex-wrap: wrap">
            <el-col
              :span="8"
              :style="index > 2 ? 'margin-top: 24px' : ''"
              v-for="(row, index) in viewDataSouse"
              :key="index"
              :value="row.orderId"
            >
              <viewList
                ref="viewRefs"
                :isMyCollection="true"
                :btnType="row.btntype"
                :viewDataSouse="row"
                :listData="listData"
                :index="index"
                :selectList="selectList"
                :isShowByEventWait="false"
                :clickView="jumpEventDetail"
                @queryEventData="queryEventData"
                @selectWarn="selectWarn"
                @getViewDataSource="getViewDataSource"
              ></viewList>
            </el-col>
          </div>
        </div>
        <!-- 表格视图 -->
        <div v-if="isShowView === 2">
          <el-table
            style="width: 100%"
            ref="table"
            :data="viewDataSouse"
            highlight-current-row
            border
            v-loading="tableLoad"
            :row-key="bindRowKey"
            @select="handleTableSelect"
            @select-all="handleSelectionChange"
            id="eventCheckTable"
            @sort-change="handleSortChange"
          >
            <el-table-column
              type="selection"
              :reserve-selection="true"
              width="48"
              align="center"
            >
            </el-table-column>
            <template v-for="(item, index) in columns">
              <el-table-column
                align="center"
                :key="item.prop + index"
                :label="item.label"
                :prop="item.prop"
                v-if="item.isShow == false || !item.checked ? false : true"
                :min-width="item.minWidth ? item.minWidth : '120'"
                width="auto"
                :show-overflow-tooltip="!item.hidnTooltip"
                :sortable="item.sort ? 'custom' : false"
              >
                <template v-slot="scope" v-if="item.prop === 'orderId'">
                  <span
                    style="cursor: pointer !important; color: #4a90e2"
                    class="spanStyle"
                    @click="jumpEventDetail(scope.row)"
                    :title="scope.row.orderId"
                    >{{ scope.row.orderId }}</span
                  >
                </template>
                <template v-slot="scope" v-else-if="item.prop === 'alarmImg'">
                  <div
                    class="img-wrapper"
                    @contextmenu.prevent="disableContextmenu"
                  >
                    <el-tooltip
                      placement="top"
                      effect="light"
                      :visible-arrow="false"
                      popper-class="myEventListTooltip"
                      :enterable="false"
                      v-for="(item, index) in getAlarmImgUrl(scope)"
                      :key="item + index"
                    >
                      <el-image :src="item" class="table-img" alt="">
                        <div slot="error" class="image-slot">
                          <img :src="defaultImg" class="" alt="" />
                        </div>
                      </el-image>
                      <div slot="content">
                        <el-image
                          @contextmenu.prevent="disableContextmenu"
                          :src="item"
                          class="table-img-tooltip"
                          alt=""
                        >
                          <div slot="error" class="image-slot">
                            <img :src="defaultImg" class="" alt="" />
                          </div>
                        </el-image>
                      </div>
                    </el-tooltip>
                  </div>
                  <!-- <EventImages :images="getAlarmImgUrl(scope)"  width="50px" height="38px"/> -->
                </template>
                <template
                  v-slot="scope"
                  v-else-if="item.prop === 'confidenceLevel'"
                >
                  <span>{{
                    scope.row.compConfidenceLevel
                      ? scope.row.compConfidenceLevel
                      : scope.row.confidenceLevel
                      ? scope.row.confidenceLevel
                      : "-"
                  }}</span>
                </template>
                <template
                  v-slot="scope"
                  v-else-if="item.prop === 'orderStatusName'"
                >
                  <span>{{
                    scope.row.enableAcceptanceMode === "1"
                      ? "待受理"
                      : scope.row.orderStatusName
                  }}</span>
                </template>
                <template v-slot="scope" v-else-if="item.prop === 'alarmTime'">
                  <span class="spanStyle" :title="scope.row.alarmTime">{{
                    timeStr(scope.row.alarmTime)
                  }}</span>
                </template>
                <template slot="scope" v-else-if="item.prop === 'reciveTime'">
                  <span class="spanStyle" :title="scope.row.reciveTime">{{
                    timeStr(scope.row.reciveTime)
                  }}</span>
                </template>
              </el-table-column>
            </template>
          </el-table>
        </div>
      </el-row>
      <el-row
        type="flex"
        justify="end"
        v-show="isShowView === 1 || isShowView === 2"
      >
        <el-pagination
          style="float: right; border: none; margin: 10px 0"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="pageData.currentPage"
          :page-sizes="pageData.page_sizes"
          :page-size="pageData.page_size"
          layout="total, sizes, prev, pager, next, jumper"
          :total="pageData.total"
          background
        >
        </el-pagination>
      </el-row>
    </el-form>
    <sorTableList
      :columns.sync="columns"
      :memoryType="sortListData.memoryType"
      :defaultList="defaultList"
      :dialogVisible.sync="sortListData.dialogVisible"
      :hideHandleBtn="true"
      @doLayout="doLayout"
    ></sorTableList>
  </div>
</template>
<script>
import $ from "jquery";
import { DateFormat, $getUrlParam } from "@/utils/public";
import viewList from "../view.vue";
import { getPreference, modify } from "@/api/system/user.js";
import "@/assets/font/iconfont.css";
import { getAllTags } from "@/api/modules/configManagemnet/labelConfig.js";
import {
  findOrderAlarm,
  getRegion,
  getCustOrganTreeNew,
  queryTenantLabelList,
  getDeviceList,
  qryWarningOrderCollection,
  getCollectionSourceByOrderId,
} from "@/api/modules/eventManagement/myFavorites/view";
import {
  getEnumInfo,
  getAllLables,
  queryTenantInfo,
  downLoadZipPost,
  getIotDeviceList,
  queryAlarmReasonList,
} from "@/api/modules/eventManagement/eventManagement";
import sorTableList from "@/components/eventManagement/sorTableList";
import { getUserMemoryOperate } from "@/api/system/custom";
import defaultImg from "@/assets/image/demoImg.png";
import EventImages from "../components/EventImages.vue";
//直辖市编码集合
const municipalityCodes = [
  "110000", //北京
  "120000", //天津
  "310000", //上海
  "500000", //重庆
];
let choiceDate0 = "";
import KeyHighSelect from "@/components/form/KeyHighSelect.vue";
export default {
  name: "myFavorites",
  components: {
    viewList,
    sorTableList,
    EventImages,
    KeyHighSelect,
  },
  data() {
    return {
      defaultImg,
      loginInfo: "",
      treeTypeUserId: "",
      treeTypeChoose: 2,
      loading: false,
      tenantList: [], //租户列表
      userIdIsShow: true,
      tagList: [],
      showButton: true, //展开收起
      isShowView: 1,
      type: "", // Fixed
      orgTreeData: [],
      orgTreeProp: {
        multiple: true,
        checkStrictly: true,
        label: "deptName",
        value: "deptId",
        children: "children",
      },
      largeBy3DList: [
        {
          name: "是",
          value: "1",
        },
        {
          name: "否",
          value: "0",
        },
      ],
      tenantkeyword: "",
      searchParams: {}, // 真实查询入参
      prevSearch: {
        params: {},
        total: 0,
      },
      qryParams: {
        //查询入参
        secondJudgeResultL: "",
        isSecondJudge: "",
        orderId: "",
        eventTitle: "", //事件标题
        area: "", //所属区域
        warnTime: "", //告警时间
        eventType: "", //告警类型
        eventSourse: "", //事件来源
        eventLevel: "", //事件等级
        eventState: "", //事件状态
        eventWait: "", //待办状态
        tenantId: "", //租户id
        tenantData: "", //租户全称
        deviceCode: "", //设备编码
        deviceCode2: "", //设备名称转编码 Fixed
        importanceLevel: "", //重要等级
        ifTimeOut: "", //是否超期
        judgeResult: "", //研判结果
        orgId: "", // 组织
        areaIds: [],
        areaCodeList: [], // 铁塔组织
        deviceLabelId: "", //标签ID
        noticeResource: "", // AI告警来源
        enlargeFlag: "", //是否3D放大
        sortName: "",
        sort: "", // asc, desc
        confidenceLevelMin: "", // 置信度最小值
        minChar: "100", // 置信度左边符号
        confidenceLevelMax: "",
        maxChar: "100",
        alarmTagIdsList: [], // 告警标签
        alarmReasonList: [], // 告警原因
      },
      selectDataSource: {
        //下拉数据源
        areaOptions: [],
        eventTypeList: [], //告警类型
        DeviceList: [], //摄像头名称
        eventSourceList: [], //事件来源
        noticeResourceList: [], // AI告警来源
        videofactoryList: [], //视频厂商
        eventLevelList: [], //事件等级
        eventStateList: [
          {
            //事件状态
            dictCode: "1",
            dictLabel: "待研判",
          },
        ],
        eventWaitList: [
          {
            dictCode: "1",
            dictLabel: "待办",
          },
          {
            dictCode: "2",
            dictLabel: "已办",
          },
        ], //事件待办
        importanceLevelList: [], //告警重要等级
        deviceLabelList: [], //设备标签列表
        iotDeviceList: [],
      },
      viewDataSouse: [], //视图数据源
      listData: [], //过滤只要orderId 和orderStatus
      pageData: {
        total: 0,
        page_sizes: [6, 18, 36, 54],
        currentPage: 1,
        page_size: 6,
      },
      tableLoad: false,
      confidenceLevelSelectData: [
        {
          value: "100",
          label: "<",
        },
        {
          value: "101",
          label: "≤",
        },
      ],
      // pickerOptions:{
      //   onPick: ({maxDate, minDate}) => {
      //     choiceDate0 = minDate.getTime();
      //     if(maxDate) {
      //       choiceDate0 = '';
      //     }
      //   },
      //   //2021-7
      //   disabledDate(time) {
      //     var nowDate=new Date();
      //     var futureDate=new Date(nowDate.getFullYear(),nowDate.getMonth() + 1,0);
      //     var nextDate=new Date("2021-7-1");
      //     var days=(nowDate.getTime() - nextDate.getTime())/(1000*60*60*24);
      //     let curDate = (new Date()).getTime();
      //     let three = days * 24 * 3600 * 1000;
      //     let threeMonths = curDate - three;
      //     futureDate = futureDate.getTime() + 24 * 3600 * 1000 - 1;
      //     let choiceDateTime = new Date(choiceDate0).getTime();
      //     const minTime = new Date(choiceDateTime).setMonth(new Date(choiceDateTime).getMonth() - 6);
      //     const maxTime = new Date(choiceDateTime).setMonth(new Date(choiceDateTime).getMonth() + 6);
      //     const min = minTime;
      //     const max = futureDate < maxTime ? futureDate : maxTime;
      //     //如果已经选中一个日期，则返回该日期前后一个月时间可选
      //     if(choiceDate0) {
      //       return time.getTime() < min || time.getTime()  > max;
      //     }
      //     //如果一个日期都没选中，则返回当前日期之前的日期可选
      //     return time.getTime() > futureDate || time.getTime() < threeMonths;
      //   }
      // },
      pickerOptions: {},
      alarmTags: [], // 告警标签
      selectList: [], // 选中的告警
      sortListData: {
        dialogVisible: false, // 自定义弹窗显隐
        memoryType: "6", //自定义列（3、事件查询、我的事件（4待办、5已办、6收藏）、7领导批示、8卫星告警）
      },
      defaultList: [], // 自定义default数组
      alarmCauseList: [],
      columns: [
        {
          label: "事件编号",
          prop: "orderId",
          minWidth: "250",
          checked: true,
          checkedDisable: true,
        },
        {
          label: "事件标题",
          prop: "alarmBody",
          minWidth: "150",
          checked: true,
        },
        {
          label: "告警图片",
          prop: "alarmImg",
          minWidth: "150",
          checked: true,
          checkedDisable: true,
          preViewImg: true,
          hidnTooltip: true,
        },
        {
          label: "告警类型",
          prop: "warningTypeName",
          minWidth: "180",
          checked: true,
        },
        {
          label: "置信度",
          prop: "confidenceLevel",
          minWidth: "110",
          checked: true,
        },
        {
          label: "告警时间",
          prop: "alarmTime",
          minWidth: "200",
          checked: true,
          sort: true,
        },
        {
          label: "接收时间",
          prop: "reciveTime",
          minWidth: "200",
          checked: true,
          sort: true,
        },
      ],
      towerColumns: [
        {
          label: "客户ID",
          prop: "tenantId",
          minWidth: "120",
          checked: true,
        },
        {
          label: "客户名称",
          prop: "tenantName",
          minWidth: "200",
          checked: true,
        },
        {
          label: "行业应用",
          prop: "industryName",
          minWidth: "125",
          checked: true,
        },
        {
          label: "应用版本",
          prop: "appVerCode",
          minWidth: "125",
          checked: true,
        },
      ],
    };
  },
  watch: {
    "qryParams.isSecondJudge": {
      handler: function () {
        //是否二次研判清空时，二次研判结果也要清空
        if (
          !this.qryParams.isSecondJudge ||
          this.qryParams.isSecondJudge == "0"
        ) {
          this.qryParams.secondJudgeResult = "";
          return;
        }
      },
    },
  },
  async activated() {
    if (this.$store.getters.userType !== "0") {
      let res = await getAllLables();
      if (res.code == 200) {
        this.alarmTags = res.data;
      }
    }
    //跳转回本页面触发
    this.queryEventData();
  },
  computed: {
    getAlarmImgUrl() {
      return (scope) => {
        let imgUrl = [];
        /**
         * 卫星告警   展示专题图或红外图，任意一个没有则展示原图   透传字段和imgUrl
         * 其他告警   左边展示框图，右边展示原图    fileImgUrlIcon 和imgUrl
         * 都没有的话则展示默认图（一般为物联告警）
         */
        if (scope.row.warningSource !== "9") {
          // 非卫星告警
          if (scope.row.fileImgUrlIcon) {
            // 框图
            imgUrl.push(scope.row.fileImgUrlIcon.split(",")[0]);
          }
          if (scope.row.imgUrl) {
            // 原图
            imgUrl.push(scope.row.imgUrl.split(",")[0]);
          }
        } else {
          if (scope.row.extraField) {
            let extraField = JSON.parse(scope.row.extraField);
            if (extraField.relativePathMir)
              imgUrl.push(extraField.relativePathMir); // 红外图
            if (extraField.relativePathThem)
              imgUrl.push(extraField.relativePathThem); // 专题图
          }
          if (imgUrl.length === 1 && scope.row.imgUrl) {
            imgUrl.push(scope.row.imgUrl.split(",")[0]); // 任意一个没有则展示一张原图
          }
          if (!imgUrl.length && scope.row.imgUrl) {
            // 都不存在则展示两张原图
            imgUrl.push(scope.row.imgUrl.split(",")[0]);
            imgUrl.push(scope.row.imgUrl.split(",")[0]);
          }
        }
        if (!imgUrl.length) {
          imgUrl.push(defaultImg);
        }
        return imgUrl;
      };
    },
  },
  mounted() {
    this.loginInfo = this.$store.getters.userInfo;
    this.getTreeType().then(() => {
      if (this.treeTypeChoose == 1) {
        this.isShowView = 2;
      }
    });
    this.getUserState();
    if (!this.userIdIsShow) {
      this.getLabelList(); //查询设备标签列表
    }
    if (!this.userIdIsShow) {
      this.getAllTags();
    }
    if (!this.qryParams.warnTime || this.qryParams.warnTime.length == 0) {
      this.getSixMonths();
    }
    this.loadInit();
  },
  created() {
    this.getCustomList();
  },
  methods: {
    // 设置快捷日期方式
    setPickerOptions() {
      let selectDate = "";
      let _this = this;
      this.pickerOptions = {
        shortcuts: [
          {
            text: "今日",
            onClick(picker) {
              const start = new Date();
              const end = new Date();
              picker.$emit("pick", _this.getTimestampsForPastXDays());
            },
          },
          {
            text: "近3天",
            onClick(picker) {
              picker.$emit("pick", _this.getTimestampsForPastXDays(3));
            },
          },
          {
            text: "近7天",
            onClick(picker) {
              picker.$emit("pick", _this.getTimestampsForPastXDays(7));
            },
          },
          {
            text: "近30天",
            onClick(picker) {
              picker.$emit("pick", _this.getTimestampsForPastXDays(30));
            },
          },
        ],
        onPick: ({ maxDate, minDate }) => {
          choiceDate0 = minDate.getTime();
          if (maxDate) {
            choiceDate0 = "";
          }
        },
        disabledDate(time) {
          var nowDate = new Date();
          var futureDate = new Date(
            nowDate.getFullYear(),
            nowDate.getMonth() + 1,
            0
          );
          var nextDate = new Date("2021-7-1");
          var days =
            (nowDate.getTime() - nextDate.getTime()) / (1000 * 60 * 60 * 24);
          let curDate = new Date().getTime();
          let three = days * 24 * 3600 * 1000;
          let threeMonths = curDate - three;
          futureDate = futureDate.getTime() + 24 * 3600 * 1000 - 1;
          let choiceDateTime = new Date(choiceDate0).getTime();
          const minTime = new Date(choiceDateTime).setMonth(
            new Date(choiceDateTime).getMonth() - 12
          );
          const maxTime = new Date(choiceDateTime).setMonth(
            new Date(choiceDateTime).getMonth() + 12
          );
          const min = minTime;
          const max = futureDate < maxTime ? futureDate : maxTime;
          //如果已经选中一个日期，则返回该日期前后一个月时间可选
          if (choiceDate0) {
            return time.getTime() < min || time.getTime() > max;
          }
          //如果一个日期都没选中，则返回当前日期之前的日期可选
          return time.getTime() > futureDate || time.getTime() < threeMonths;
        },
      };
    },
    handleCascaderChange(val) {
      let nodes = this.$refs.orgName
        .getCheckedNodes()
        .filter((node) => node.level !== 1);
      const map = {};
      nodes = nodes.map((node) => {
        const areaCode = node.level === 2 ? node.value : node.parent.value;
        const v = {
          areaCode,
          isDirectly: municipalityCodes.includes(areaCode) ? "1" : undefined,
          childrenAreaCodeList: [],
        };
        if (!map[areaCode]) {
          map[areaCode] = v;
        }
        if (node.level === 3) {
          map[areaCode].childrenAreaCodeList.push(node.value);
        }
        return map[areaCode];
      });
      const result = [];
      nodes.reduce((prev, cur) => {
        if (prev.areaCode !== cur.areaCode) {
          result.push(cur);
        }
        return cur;
      }, {});
      this.qryParams.areaCodeList = val.length > 0 ? result : [];
    },
    async getTreeType() {
      this.treeTypeUserId = this.loginInfo.userId;
      // 铁塔视角切换为客户视角时，判断userId是否随切视角变化?
      if (!this.loginInfo.tenantId) {
        this.treeTypeUserId = this.loginInfo.userId;
      }
      const param = {
        prefPage: "21",
        prefType: "53",
        userId: this.treeTypeUserId,
      };
      try {
        const res = await getPreference(param);
        if (res.code == "200") {
          const { prefValue = "2", sysUserPrefId } = res.data[0] || {};
          this.sysUserPrefTreeTypeId = sysUserPrefId;
          this.treeTypeChoose = prefValue;
        } else {
          throw new Error(res?.msg);
        }
      } catch (error) {
        throw new Error(error);
      }
    },
    /**
     * 存储 树类型
     */
    async doChangeTreeType() {
      const prefValue = this.treeTypeChoose == "1" ? "2" : "1";
      const res = await modify({
        prefPage: "21",
        prefType: "53",
        prefValue,
        userId: this.treeTypeUserId,
        sysUserPrefId: this.sysUserPrefTreeTypeId,
      });
      if (res.code == "200") {
        this.treeTypeChoose = prefValue;
      }
    },
    /**
     * 铁塔账号 租户选择
     */
    tenantChange(tenantId) {
      this.qryParams.tenantId = tenantId;
    },
    /**
     * 铁塔账号 关键字查询租户
     */
    searchTenant(query) {
      let params = {
        keyword: query,
      };
      queryTenantInfo(params).then(
        (resp) => {
          if (resp && resp.code == 200) {
            for (let i in resp.data) {
              resp.data[i].tenantName =
                resp.data[i].tenantName + "(" + resp.data[i].tenantId + ")";
            }
            this.tenantList = resp.data;
          } else {
            this.tenantList = [];
          }
        },
        () => {
          this.tenantList = [];
        },
        false
      );
    },
    getAllTags() {
      getAllTags().then((res) => {
        if (res.code == 200) {
          this.tagList = res.data;
        }
      });
    },
    verifyConfidenceLevel(input, property) {
      var reg = /^(0\.\d+|0|1)$/;
      if (reg.test(input)) {
        this.qryParams[property] = input;
      } else {
        if (input != "0.") {
          this.qryParams[property] = "";
        }
      }
    },
    channelInputLimit(e) {
      let key = e.key;
      // 不允许输入'e'和'.'
      if (key === "e" || key === "-") {
        e.returnValue = false;
        return false;
      }
      return true;
    },
    // 导出
    leaderExport() {
      let $loginInfo = this.$store.getters.userInfo;
      // this.viewDataSouse = [];
      let params = this.prevSearch.params;
      let isevent = "";
      if (this.$store.getters.userInfo.tenantId) {
        isevent = "/export";
      } else {
        isevent = "/ttexport";
      }
      let url = isevent + `/alarm/order/exportWarningOrderCollection`;
      if (this.prevSearch.total >= 5000) {
        $message.warning("导出数据量最多5000条，请按照查询条件导出。");
      } else {
        this.exportExcel(url, params, "我的事件导出文件");
      }
    },
    getUserState() {
      // let user = $store.get('$loginInfo');
      let user = this.$store.getters.userInfo;
      if (user.tenantId) {
        this.custIsShow = true;
      }
      this.userIdIsShow = user.userType !== "2";
      this.searchAlarmCause();
    },
    loadInit() {
      let _this = this;
      this.getEnumInfo(
        {
          enumTypeId: 41,
        },
        (result) => {
          _this.selectDataSource.eventLevelList = result.data;
        }
      );
      this.onLoadData_type();
      this.getEnumInfo(
        {
          enumTypeId: "warning_source_common",
        },
        (result) => {
          _this.selectDataSource.eventSourceList = result.data;
        }
      );
      this.onLoadData_area();
      this.getEnumInfo(
        {
          enumTypeId: 65,
        },
        (result) => {
          _this.selectDataSource.eventStateList = result.data.filter((item) => {
            return item.dictValue != "3";
          });
        }
      );
      this.getEnumInfo(
        {
          enumTypeId: 90,
        },
        (result) => {
          _this.selectDataSource.importanceLevelList = result.data;
        }
      );
      getEnumInfo({
        enumTypeId: 103,
      }).then((res) => {
        if (res.code == 200) {
          this.selectDataSource.videofactoryList = res.data;
        }
      });
      getEnumInfo({
        enumTypeId: 102,
      }).then((res) => {
        if (res.code == 200) {
          this.selectDataSource.noticeResourceList = res.data;
        }
      });
      this.getType();
      if (this.$store.getters.userInfo.tenantId) {
        // 获取组织树数据
        this.getCustOrganTree();
      } else {
        this.orgTreeData = this.$store.getters.userDeptTreeOptions;
        this.orgTreeProp.label = "label";
        this.orgTreeProp.value = "id";
      }
      this.getViewDataSource();
    },
    onLoadData_type() {
      let _this = this;
      let param = {};
      if (this.$store.getters.userInfo.tenantId) {
        param.tenantId = this.$store.getters.userInfo.tenantId;
      }
      findOrderAlarm(param).then((res) => {
        if (res.code === 200) {
          this.selectDataSource.eventTypeList = res.data;
        }
      });
    },
    onLoadData_area() {
      let _this = this;
      _this.selectDataSource.areaOptions = [];
      _this.onLoadData_province();
    },
    onLoadData_province() {
      let _this = this;
      // $v.post(
      //   _this,
      //   urlVideo + "/video/getRegion",
      //   { areaLevel: 1 },
      //   function (result) {
      //     if (result.resultStat === "SUCCESS") {
      //       for (let i = 0; i < result.data.length; i++) {
      //         let row = result.data[i];
      //         _this.selectDataSource.areaOptions.push({
      //           label: row.areaName,
      //           value: row.areaCode,
      //           children: [],
      //         });
      //       }
      //     }
      //   }
      // );
      getRegion({
        areaLevel: 2,
      }).then((res) => {
        if (res.code === 200) {
          for (let i = 0; i < res.data.length; i++) {
            let row = res.data[i];
            this.selectDataSource.areaOptions.push({
              label: row.areaName,
              value: row.areaCode,
              children: [],
            });
          }
        }
      });
    },
    getEnumInfo(params, success) {
      let _this = this;
      // $v.post(_this, urlSystem + "/system/getEnumInfo", params, (resp) => {
      //   if (resp.resultStat === "SUCCESS") {
      //     if (success) {
      //       success(resp);
      //     }
      //   }
      // });
      getEnumInfo(params).then((res) => {
        if (res.code === 200) {
          if (success) {
            success(res);
          }
        }
      });
    },
    // 归属组织树
    getCustOrganTree() {
      // $v.post(
      //   this,
      //   `${urlSystem}/system/custorgan/getCustOrganTreeNew`,
      //   {
      //     orgSource: "1",
      //     orgType: "1",
      //   },
      //   (res) => {
      //     if (res.resultStat === "SUCCESS") {
      //       this.$data.orgTreeData = this.transformTreeData(res.data);
      //     } else {
      //       $v.message({
      //         type: res.resultStat,
      //         mess: res.mess,
      //         data: res.data,
      //       });
      //     }
      //   }
      // );
      getCustOrganTreeNew({
        orgSource: "1",
        orgType: "1",
        tenantId: this.$store.getters.userInfo.tenantId,
      }).then((res) => {
        if (res.code === 200) {
          this.$data.orgTreeData = res.data;
          // this.$data.orgTreeData = this.transformTreeData(res.data);
        } else {
          // $v.message({
          //   type: res.resultStat,
          //   mess: res.mess,
          //   data: res.data,
          // });
          $message.warning(res.mess);
        }
      });
    },
    transformTreeData(treeData) {
      if (treeData.length) {
        let cloneData = JSON.parse(JSON.stringify(treeData)).filter((item) => {
          return item.orgType != "2";
        }); // 对源数据深度克隆
        return cloneData.filter((father) => {
          let branchArr = cloneData.filter(
            (child) => father.orgId == child.parentOrgId
          ); //返回每一项的子级数组
          if (branchArr.length > 0) {
            //如果存在子级，则给父级添加一个children属性，并赋值
            father.children = branchArr;
          }
          return father.orgLevel == "1"; //返回第一层
        });
      }
      return [];
    },
    //标签列表
    getLabelList() {
      let param = {};
      if (this.$store.getters.userInfo.tenantId) {
        param.tenantId = this.$store.getters.userInfo.tenantId;
      }
      queryTenantLabelList(param).then((res) => {
        if (res.code === 200) {
          this.$data.selectDataSource.deviceLabelList = res.data;
        } else {
          // $v.message({
          //   type: res.resultStat,
          //   mess: res.mess,
          //   data: res.data,
          // });
          $message.warning(res.mess);
        }
      });
    },
    // 视图切换
    viewClick(val) {
      switch (val) {
        case 1:
          this.isShowView = 1;
          this.$nextTick(() => {
            for (let i = 0; i < this.viewDataSouse.length; i++) {
              this.$refs.viewRefs[i].autoHeight();
            }
          });
          this.getTreeType().then(() => {
            this.doChangeTreeType();
          });
          break;
        case 2:
          this.isShowView = 2;
          this.getTreeType().then(() => {
            this.doChangeTreeType();
            this.handleCheckData();
          });

          break;
      }
    },
    queryEventData() {
      if (!this.checkConfidenceLevel()) {
        $message.error(
          "“最小值、最大值”需至少填写一项，且最小值需要小于等于最大值"
        );
        return;
      }
      this.selectDataSource.DeviceList = [];
      this.pageData = {
        total: 0,
        page_sizes: [6, 18, 36, 54],
        currentPage: 1,
        page_size: 6,
      };
      this.getViewDataSource();
    },
    selectWarn(data) {
      const index = this.selectList.findIndex(
        (item) => item.orderId == data.orderId
      );
      if (index < 0) {
        this.selectList.push(data);
      } else {
        this.selectList.splice(index, 1);
      }
      if (this.selectList.length > 10) {
        $message.warning(
          `最多选择100条，已选择` + this.selectList.length + `条！！！`
        );
      }
    },
    // Fixed 标签名称问题
    resetFormData() {
      this.qryParams = {
        eventTitle: "", //事件标题
        area: "", //所属区域
        warnTime: "", //告警时间
        eventType: "", //告警类型
        eventSourse: "", //事件来源
        eventLevel: "", //事件等级
        eventState: "", //事件状态
        deviceCode: "",
        deviceCode2: "",
        importanceLevel: "", //重要等级
        judgeResult: "", //研判结果
        orgIds: [], // 组织名称
        areaIds: [],
        areaCodeList: [],
        deviceLabelId: "", //设备标签id
        sortName: "",
        sort: "",
        confidenceLevelMin: "", // 置信度最小值
        minChar: "100", // 置信度左边符号
        confidenceLevelMax: "",
        maxChar: "100",
        alarmReasonList: [],
      };
      if (this.$refs.table) {
        this.$refs.table.clearSort();
      }

      this.selectDataSource.DeviceList = [];
      this.pageData = {
        total: 0,
        page_sizes: [6, 18, 36, 54],
        currentPage: 1,
        page_size: 6,
      };
      this.tenantList = [];
      this.tenantkeyword = "";
      this.getSixMonths();
      this.getViewDataSource();
    },
    handleSizeChange(val) {
      this.pageData.page_size = val;
      this.getViewDataSource(true);
    },
    handleCurrentChange(val) {
      this.pageData.currentPage = val;
      this.getViewDataSource(true);
    },
    //展开收起
    showSelect() {
      let _this = this;
      _this.showButton = !_this.showButton;
    },
    areaChangeFun(code) {
      if (code.length == 3 || code.length == 0) {
        return;
      }
      let _this = this;
      let list = [];
      // $v.post(
      //   _this,
      //   urlVideo + "/video/getRegion",
      //   {
      //     areaLevel: code.length == 1 ? 2 : 3,
      //     areaParentCode: code[code.length - 1],
      //   },
      //   function (result) {
      //     if (result.resultStat === "SUCCESS") {
      //       if (code.length == 1) {
      //         for (let i = 0; i < result.data.length; i++) {
      //           let item = result.data[i];
      //           list.push({
      //             label: item.areaName,
      //             value: item.areaCode,
      //             children: [],
      //           });
      //         }
      //         for (
      //           let i = 0;
      //           i < _this.selectDataSource.areaOptions.length;
      //           i++
      //         ) {
      //           let row = _this.selectDataSource.areaOptions[i];
      //           if (row.value == code[0]) {
      //             _this.selectDataSource.areaOptions[i].children = list;
      //           }
      //         }
      //       } else if (code.length == 2) {
      //         for (let i = 0; i < result.data.length; i++) {
      //           let item = result.data[i];
      //           list.push({
      //             label: item.areaName,
      //             value: item.areaCode,
      //           });
      //         }
      //         for (
      //           let count = 0;
      //           count < _this.selectDataSource.areaOptions.length;
      //           count++
      //         ) {
      //           for (
      //             let j = 0;
      //             j < _this.selectDataSource.areaOptions[count].children.length;
      //             j++
      //           ) {
      //             let row =
      //               _this.selectDataSource.areaOptions[count].children[j];
      //             if (row.value == code[1]) {
      //               _this.selectDataSource.areaOptions[count].children[
      //                 j
      //               ].children = list;
      //             }
      //           }
      //         }
      //       }
      //     }
      //   }
      // );
      getRegion({
        areaLevel: code.length == 1 ? 3 : 4,
        areaParentCode: code[code.length - 1],
      }).then((res) => {
        if (res.code === 200) {
          if (code.length == 1) {
            for (let i = 0; i < res.data.length; i++) {
              let item = res.data[i];
              list.push({
                label: item.areaName,
                value: item.areaCode,
                children: [],
              });
            }
            for (let i = 0; i < this.selectDataSource.areaOptions.length; i++) {
              let row = this.selectDataSource.areaOptions[i];
              if (row.value == code[0]) {
                this.selectDataSource.areaOptions[i].children = list;
              }
            }
          } else if (code.length == 2) {
            for (let i = 0; i < res.data.length; i++) {
              let item = res.data[i];
              list.push({
                label: item.areaName,
                value: item.areaCode,
              });
            }
            for (
              let count = 0;
              count < this.selectDataSource.areaOptions.length;
              count++
            ) {
              for (
                let j = 0;
                j < this.selectDataSource.areaOptions[count].children.length;
                j++
              ) {
                let row = this.selectDataSource.areaOptions[count].children[j];
                if (row.value == code[1]) {
                  this.selectDataSource.areaOptions[count].children[
                    j
                  ].children = list;
                }
              }
            }
          }
        }
      });
    },
    areaExpandChangeFun(code) {},
    /* 获取设备 */
    getDevice(query) {
      let _this = this;
      if (query) {
        let params = {
          devName: query,
          cityId: _this.getCityId(_this.qryParams.area),
          provinceId: _this.getProvinceId(_this.qryParams.area),
          countyId: _this.getCountyId(_this.qryParams.area),
        };
        // $v.post(
        //   _this,
        //   urlVideo + "/video/warningEvent/getDeviceList",
        //   params,
        //   function (result) {
        //     if (result.resultStat === "SUCCESS") {
        //       _this.selectDataSource.DeviceList = [];
        //       _this.selectDataSource.DeviceList = result.data;
        //     }
        //   }
        // );
        getDeviceList(params).then((res) => {
          if (res.code === 200) {
            this.selectDataSource.DeviceList = [];
            this.selectDataSource.DeviceList = res.data;
          }
        });
      } else {
        _this.selectDataSource.DeviceList = [];
      }
    },
    // 物联设备
    async getIotDevice(query) {
      let _this = this;
      if (query) {
        let params = { codeOrName: query };
        let result = await getIotDeviceList(params);
        if (result.code === 200) {
          _this.selectDataSource.iotDeviceList = result.data;
        }
      } else {
        _this.selectDataSource.iotDeviceList = [];
      }
    },
    clearDevice(b) {
      if (b === false) {
        this.selectDataSource.DeviceList = [];
      }
    },
    /* 获取设备 */
    // Fixed
    getType() {
      let url = location + "";
      if (url.indexOf("?") !== -1) {
        this.type = $getUrlParam("type");
        switch (this.type) {
          case "2":
            this.qryParams.eventState = "1";
            this.qryParams.eventWait = "1";
            this.qryParams.warnTime = null;
            break;
          case "3":
            this.qryParams.eventState = "2";
            this.qryParams.eventWait = "1";
            this.qryParams.warnTime = null;
            break;
          case "4":
            this.qryParams.eventState = "4";
            this.qryParams.eventWait = "1";
            this.qryParams.warnTime = null;
            break;
          case "5":
            this.qryParams.eventState = "5";
            this.qryParams.eventWait = "1";
            this.qryParams.warnTime = null;
            break;
        }
      }
    },
    /**
     * params添加参数,空字符串不添加
     * @param params
     * @param value 字段值
     * @param nullValue 字段空时的默认值
     * @param name 字段
     */
    addParam(params, name, value, nullValue) {
      if (value !== "" && value != null) {
        params[name] = value;
      } else {
        if (nullValue) {
          params[name] = nullValue;
        }
      }
    },
    getViewDataSource(val) {
      this.tableLoad = true;
      let _this = this;
      let $loginInfo = this.$store.getters.userInfo;
      this.viewDataSouse = [];
      let params = this.getSearchParams();
      this.searchParams = params;
      qryWarningOrderCollection({
        ...params,
      }).then((res) => {
        this.tableLoad = false;
        if (!val) {
          this.resetSelect();
        }
        if (res.code === 200) {
          this.pageData.total = res.data.total;
          this.viewDataSouse = res.data.rows;
          this.listData = res.data.rows?.map(({ orderStatus, orderId }) => ({
            orderStatus,
            orderId,
          }));
          if (this.isShowView === 2) {
            this.handleCheckData();
          }
        }
        this.prevSearch.params = JSON.parse(JSON.stringify(params));
        this.prevSearch.total = res.data.total;
      });
    },
    async jumpEventDetail(row) {
      let params = {
        orderId: row.orderId,
      };
      const collectionAlarmLinkData = {
        0: "/eventLinks", // 事件查询
        1: "/recycleBinDetail", // 回收站
        2: "/custOperateDetail", // 运营研判
        3: "/custOperateDetail", // 属地运营研判
      };
      const res = await getCollectionSourceByOrderId(params);
      //   "isCollectionSource": "0" //来源标识（0：事件查询、1：回收站、2：运营研判）
      let query = {
        orderId: row.orderId,
        orderStatus: row.orderStatus,
        searchParams: JSON.stringify(this.searchParams),
        pageType: "myFavorites",
        type: 4, // 老逻辑，未知含义
      };
      const collectionSource = res.data.isCollectionSource;
      if (collectionSource === "1") {
        query.page = 11; // 标识回收站详情
      }
      if (collectionSource === "3") {
        query.localFlag = "1"; // 属地标识
      }
      // 铁塔视角 || 删除告警  || 转移告警  ||  没有处理权限
      if (
        !this.$store.getters.userInfo.tenantId ||
        row.deleteFlag === 1 ||
        row.deleteFlag === 2
      ) {
        query.isDetail = "1";
      }
      if (res.code === 200) {
        let routeName = collectionAlarmLinkData[collectionSource];
        if (row.deleteFlag === 1) {
          routeName = "/recycleBinDetail";
          query.page = 12;
        }
        if (row.deleteFlag === 2) {
          routeName = "/recycleBinDetail";
          query.page = 13;
        }
        this.$linkto(routeName, query);
      } else {
        $message.error("获取告警事件来源失败");
      }
    },
    getProvinceId(code) {
      if (code != null && code != "") {
        return code[0];
      }
      return null;
    },
    getCityId(code) {
      if (code != null && code != "" && code != "" && code.length > 1) {
        return code[1];
      }
      return null;
    },
    getCountyId(code) {
      if (code != null && code != "" && code != "" && code.length > 2) {
        return code[2];
      }
      return null;
    },
    // 表格时间格式转化
    timeStr(str) {
      return DateFormat.utcTimeToStrTime(str + "");
    },

    handleSortChange({ prop, order }) {
      if (order) {
        this.qryParams.sortName = prop;
        this.qryParams.sort = order === "ascending" ? "asc" : "desc";
      } else {
        this.qryParams.sortName = "";
        this.qryParams.sort = "";
      }
      this.queryEventData();
    },
    //  获取今天到前一个月日期
    getSixMonths() {
      const [minTime, date] = this.getTimestampsForPastXDays(7);
      let currentTime = `${date.getFullYear()}-${
        date.getMonth() + 1
      }-${date.getDate()} 23:59:59`;
      let onceTime = `${minTime.getFullYear()}-${
        minTime.getMonth() + 1
      }-${minTime.getDate()} 00:00:00`;
      let defaultTime = [onceTime, currentTime];
      this.qryParams.warnTime = defaultTime;
      this.qryParams = JSON.parse(JSON.stringify(this.qryParams));
    },
    // 置信度输入校验
    checkConfidenceLevel() {
      if (
        this.qryParams.confidenceLevelMin != "" &&
        this.qryParams.confidenceLevelMin == this.qryParams.confidenceLevelMax
      ) {
        this.qryParams.minChar = "101";
        this.qryParams.maxChar = "101";
        return true;
      }
      if (
        this.qryParams.confidenceLevelMin != "" &&
        this.qryParams.confidenceLevelMax != "" &&
        Number(this.qryParams.confidenceLevelMin) >
          Number(this.qryParams.confidenceLevelMax)
      ) {
        return false;
      }
      return true;
    },
    changeSecondJudgeResult() {
      this.qryParams = JSON.parse(JSON.stringify(this.qryParams));
    },
    bindRowKey(row) {
      return row.orderId;
    },
    handleTableSelect(val, row) {
      const index = this.selectList.findIndex(
        (item) => item.orderId == row.orderId
      );
      if (index == -1) {
        this.selectList.push(row);
      } else {
        this.selectList.splice(index, 1);
      }
    },
    handleSelectionChange(val) {
      const checked = !$("#eventCheckTable thead .el-checkbox").hasClass(
        "is-checked"
      );
      if (!checked) {
        this.selectList = this.selectList.filter(
          (item) =>
            !this.viewDataSouse.find((obj) => item.orderId == obj.orderId)
        );
      } else {
        this.viewDataSouse.forEach((item) => {
          if (!this.selectList.find((obj) => item.orderId == obj.orderId)) {
            this.selectList.push(item);
          }
        });
      }
    },
    getSearchParams() {
      let _this = this;
      let params = {
        cityId: this.getCityId(this.qryParams.area),
        provinceId: this.getProvinceId(this.qryParams.area),
        countyId: this.getCountyId(this.qryParams.area),
        pageNum: this.pageData.currentPage,
        pageSize: this.pageData.page_size,
        modelId: _this.qryParams.modelId == "" ? null : _this.qryParams.modelId,

        noticeResource:
          this.qryParams.noticeResource == ""
            ? null
            : this.qryParams.noticeResource,
        // confidenceLevel: this.qryParams.confidenceLevel == "" ?
        //   null :
        //   this.qryParams.confidenceLevel,
        confidenceLevelMin: this.qryParams.confidenceLevelMin,
        confidenceLevelMax: this.qryParams.confidenceLevelMax,
        minChar: this.qryParams.minChar,
        maxChar: this.qryParams.maxChar,
      };
      if (this.qryParams.warnTime && this.qryParams.warnTime.length > 0) {
        params.alarmTimeStart = this.qryParams.warnTime[0];
        params.alarmTimeEnd = this.qryParams.warnTime[1];
      }
      this.addParam(params, "orderId", this.qryParams.orderId);
      this.addParam(params, "alarmBody", this.qryParams.eventTitle);
      this.addParam(params, "warningSource", this.qryParams.eventSourse);
      this.addParam(params, "emergencyLevel", this.qryParams.eventLevel);
      this.addParam(params, "warningTypeIdList", this.qryParams.eventType);
      this.addParam(params, "ifTimeOut", this.qryParams.ifTimeOut);
      this.addParam(params, "orderStatusList", this.qryParams.eventState);
      this.addParam(params, "searchType", this.qryParams.eventWait, "0");
      // this.addParam(params, "tenantId", $loginInfo.tenantId);
      this.addParam(params, "importanceLevel", this.qryParams.importanceLevel);
      this.addParam(params, "judgeResult", this.qryParams.judgeResult, "");
      this.addParam(params, "deviceLabelIdList", this.qryParams.deviceLabelId);
      this.addParam(params, "tagIdList", this.qryParams.tagIdList);
      this.addParam(params, "tenantId", this.qryParams.tenantId);
      this.addParam(params, "isSecondJudge", this.qryParams.isSecondJudge);
      this.addParam(params, "sortName", this.qryParams.sortName);
      this.addParam(params, "sort", this.qryParams["sort"]);
      this.addParam(params, "areaCodeList", this.qryParams.areaCodeList);
      this.addParam(
        params,
        "secondJudgeResult",
        this.qryParams.secondJudgeResult
      );
      this.addParam(params, "enlargeFlag", this.qryParams.enlargeFlag);
      // 组织名称

      // 物联设备
      const codes = [];
      const { iotDeviceCode, iotDeviceCode2 } = this.qryParams;
      if (iotDeviceCode) codes.push(iotDeviceCode);
      if (iotDeviceCode2) codes.push(iotDeviceCode2);
      if (codes.length) this.addParam(params, "iotDeviceCode", codes);
      // 二次识别
      this.addParam(
        params,
        "isSecondIdentify",
        this.qryParams.isSecondIdentify
      );
      this.addParam(
        params,
        "secondIdentifyResult",
        this.qryParams.secondIdentifyResult
      );
      // 组织名称

      const { orgIds = [] } = this.qryParams;
      let orgIdList = "";
      if (orgIds.length > 0) {
        orgIdList = orgIds.map((item) => {
          return item[item.length - 1];
        });
      }
      this.addParam(params, "orgIdList", orgIdList);
      let device = [];
      if (this.qryParams.deviceCode) {
        device.push(this.qryParams.deviceCode);
      }
      if (this.qryParams.deviceCode2) {
        device.push(this.qryParams.deviceCode2);
      }
      params.deviceCode = device;
      params.lableIdList = this.qryParams.alarmTagIdsList;
      params.alarmReasonList = this.qryParams.alarmReasonList;
      return params;
    },
    /**
     * 下载告警图片
     */
    downAlarmImg() {
      if (
        this.selectList.length > 50 ||
        (!this.selectList.length && this.prevSearch.total > 50)
      ) {
        return $message.warning("最多可选50个告警事件。");
      }
      if (!this.selectList.length && !this.prevSearch.total) {
        return $message.warning("请选择告警事件。");
      }
      let params = {};
      if (!this.selectList.length) {
        // 根据查询条件导出
        params.downLoadType = "3"; // 我的收藏 为3  事件查询  1   回收站  2
      } else {
        // 根据选中的告警事件导出
        params.downLoadType = "0";
      }
      params.orderIdDownLoadType = "3"; //我的收藏  3  事件查询 1  回收站  2
      params.downLoadOrderDTO = this.prevSearch.params;
      params.warningOrderIds = this.selectList.map((item) => item.orderId);
      let fileName = "告警图片下载";
      let url = "";
      if (this.$store.getters.userInfo.tenantId) {
        url = "/export/alarm/order/downloadImgs";
      } else {
        url = "/export/alarm/order/downLoadImgsTower";
        params.name = "中国铁塔"; // 铁塔视角固定值
      }
      downLoadZipPost(url, fileName, params);
    },
    /**
     * 清除选中样式
     */
    resetSelect() {
      this.selectList = [];
      if (this.$refs.table) {
        this.$refs.table.clearSelection();
      }
    },
    /**
     * 表格重新布局
     */
    doLayout() {
      this.$nextTick(() => {
        this.$refs.table.doLayout();
        this.$refs.table.$forceUpdate();
        this.sortListData.dialogVisible = false;
      });
    },
    /**
     * 打开自定义列弹窗
     */
    handleColumn() {
      this.sortListData.dialogVisible = true;
    },
    /**
     * 自定义列预操作
     */
    getCustomList() {
      if (this.$store.getters.userInfo.userType !== "2") {
        this.columns = [...this.towerColumns, ...this.columns];
      }
      this.defaultList = JSON.parse(JSON.stringify(this.columns));
      let params = {
        memoryType: "",
        userId: this.$store.getters.userInfo.userId,
      };
      getUserMemoryOperate(params).then((res) => {
        if (res.code == 200 && res.data.length > 0) {
          let customItem = {};
          res.data.map((item) => {
            customItem[item.memoryType] = item.memoryTable;
          });
          if (customItem[this.sortListData.memoryType]) {
            this.columns = JSON.parse(customItem[this.sortListData.memoryType]);
            this.columns = this.compareJSONArrays(
              this.defaultList,
              this.columns
            );
          }
        }
      });
    },
    handleCheckData() {
      let tableData = this.viewDataSouse; // 从后台获取到的数据
      this.$nextTick(() => {
        tableData.forEach((item) => {
          const index = this.selectList.findIndex(
            (itemList) => itemList.orderId == item.orderId
          );
          if (index >= 0) {
            this.$refs.table && this.$refs.table.toggleRowSelection(item, true);
          } else {
            this.$refs.table &&
              this.$refs.table.toggleRowSelection(item, false);
          }
        });
      });
    },
    // 工具函数
    compareJSONArrays(jsonArray1, jsonArray2) {
      let intersection = jsonArray1.map((item) => {
        for (let i = 0; i < jsonArray2.length; i++) {
          if (item.prop === jsonArray2[i].prop) {
            return item;
          }
        }
      });
      return intersection;
    },
    disableContextmenu() {
      return false;
    },
    // 查询告警原因列表
    searchAlarmCause() {
      if (!this.userIdIsShow) {
        queryAlarmReasonList({}).then((res) => {
          if (res.code === 200) {
            this.alarmCauseList = res.data;
          }
        });
      }
    },
    /**
     * 获取过去X天的日期和时间戳
     * @param days 天数
     * @returns {number[]}
     */
    getTimestampsForPastXDays(days = 0) {
      const day = days === 0 ? 0 : days - 1;
      // 获取今天的日期和时间
      let today = new Date();
      // 设置今天的时间为23:59:59
      today.setHours(23, 59, 59, 0);

      // 创建一个新的Date对象，设置为X天前的日期
      const pastDay = new Date(today);
      pastDay.setDate(today.getDate() - day); // 这里减一是兼容业务
      // 设置时间为00:00:00
      pastDay.setHours(0, 0, 0, 0);

      return [pastDay, today];
    },
  },
};
</script>
<style lang="scss">
.el-tooltip__popper.myEventListTooltip.is-light {
  background: transparent;
  border: none;
}
</style>
<style lang="scss" scoped>
$theme: var(--theme);

.table-img-tooltip {
  margin: -20px 0 -30px 300px;
  width: 500px;
  height: 282px;
  box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.06);
  border-radius: 2px;
  .image-slot,
  img {
    width: 100%;
    height: 100%;
  }
}

.table-img {
  width: 60px;
  height: 38px;
  margin-top: 3.6px;
  border-radius: 2px;
}

.custom-hr {
  margin: 12px 0px 12px 0px;
  background-color: #f0f0f0;
  border: none;
  height: 1px;
}

/deep/ .el-button.el-button--small {
  height: 32px;
  line-height: 22px;
  padding: 0 11px;
  margin-left: 0;
}

/deep/ #findtenantId .el-input__inner,
#alarmTime .el-input__inner {
  height: 32px !important;
  line-height: 40px;
}

.page-input {
  margin-bottom: 0 !important;
  padding: 20px 20px 10px !important;

  /deep/ .el-form-item.el-form-item--small {
    margin-bottom: 0;
  }
}

.page-input .el-row {
  margin: 0;
}

.page-input .el-col-24 {
  height: 40px !important;
}

.data-view-container {
  margin: 10px 0;
}

.data-view-container::after {
  content: "";
  display: block;
  clear: both;
}

.data-view-btn {
  padding: 0 6px;
  box-sizing: content-box;
  height: 33px;
  width: 21px;
  line-height: 35px;
  margin-left: 10px;
}

.eventTopRow {
  margin: 0 0 0 0;
}

/deep/ .eventMidRow {
  margin: 10px 0 !important;
  text-align: center !important;
}

/deep/ .tableSpan span {
  color: #ffffff;
}

/*搜索*/
#searchid1 /deep/ .el-input__inner {
  display: inline !important;
  width: 100% !important;
  height: 40px;
  line-height: 40px;
}

#searchid1 /deep/ .search {
  width: 100% !important;
  height: 40px;
  line-height: 40px;
}

#searchid1 .search span {
  height: 40px;
  line-height: 40px;
}

#searchid1 /deep/ .el-input__icon {
  line-height: 40px;
}

#searchid1 .el-pagination {
  margin: 0px;
}

#searchid1 .homeSearch {
  width: 100%;
  height: 40px;
  float: right;
  margin-right: 38px;
  position: relative;
  border-radius: 4px;
}

#searchid1 .spanStyle {
  white-space: nowrap;
  /*强制span不换行*/
  display: inline-block;
  /*将span当做块级元素对待*/
  width: 100%;
  /*限制宽度*/
  overflow: hidden;
  /*超出宽度部分隐藏*/
  text-overflow: ellipsis;
  /*超出部分以点号代替*/
}

#searchid1 .el-pagination {
  background: #ffffff;
  margin: 0;
}

.tableStyle {
  padding: 0 10px;
  //min-height: 450px;
}

/deep/ #findtenantId .el-input__inner {
  height: 40px;
  line-height: 40px;
}

/deep/ .el-table--small td,
/deep/ .el-table--small th {
  padding: 0;
  //height: 45px;
}

.eventSelectClass {
  background: $theme;
  color: #ffffff;
  float: right;
}

.eventUnSelectClass {
  background: #ffffff;
  color: #2c2f33;
  float: right;
}

#showButtonId {
  display: block;
  width: 2em;
  height: 5em;
  text-align: center;
  white-space: normal;
  padding: 0 !important;
  position: absolute;
  right: -0.8em;
  top: 2em;
  box-shadow: none !important;
  border: 1px white solid !important;
}

/deep/ .el-input {
  font-size: 14px !important;
}

#alarmTime .el-input__inner {
  height: 32px !important;
  line-height: 40px;
}

#button {
  padding-top: 14px;
}

/deep/.no-tips input::-webkit-outer-spin-button,
/deep/.no-tips input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
}

/deep/.no-tips input[type="number"] {
  -moz-appearance: textfield !important;
}

/deep/.el-date-editor .el-range-separator {
  height: 28px !important;
  display: block;
}
/deep/.clear-icon .el-range__close-icon {
  display: none;
}
/deep/.has-gutter .cell {
  height: 40px;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
/deep/.el-table__body-wrapper .cell {
  display: block;
  height: 45px;
  line-height: 45px;
}
/deep/ .el-form .el-form-item .el-form-item__content {
  padding: 0 0 0 12px;
  //margin-left: 102px !important;
}
/deep/ .el-form .el-form-item.el-form-item--small {
  margin-bottom: 12px !important;
}
/deep/ .el-select input::placeholder {
  color: #909399 !important;
}
/deep/ .el-input input::placeholder {
  color: #909399 !important;
}
/deep/.el-cascader__search-input::placeholder {
  color: #909399 !important;
}
.confidenceLevel /deep/ .el-icon-arrow-up:before {
  content: "\e78f";
}
.input-wrapper {
  width: 100%;
  height: 32px;
  display: flex;
  flex-wrap: nowrap;
  border: 1px solid #dcdfe6;
  border-radius: 5px;
  position: relative;
  .tips {
    position: absolute;
    left: 0;
    top: 32px;
    font-size: 12px;
    color: #ff6a6c;
    height: 12px;
    line-height: 1;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}
.bor /deep/.el-input__inner {
  border: none;
  height: 100%;
  padding: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  font-size: 14px;
  text-align: center;
  padding-left: unset !important;
}
.bor /deep/ .el-select .el-input__inner {
  text-align: right;
}
.bor {
  flex: 1;
  border-right: 1px solid #dcdfe6;
  display: flex;
  justify-content: center;
  /deep/.el-input--small {
    height: 30px;
    line-height: 30px;
  }
  /deep/.el-select--small {
    height: 30px;
    line-height: 30px;
    max-width: 60px;
  }
  /deep/.el-input__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #909399;
  }
}
.confidenceLevel .bor-none {
  border: none;
}
.bor /deep/.el-select .el-input input {
  font-size: 16px;
  height: 28px;
  line-height: 28px;
}
.center-text {
  white-space: nowrap;
  background-color: #f4f4f5;
  color: rgba(51, 51, 51, 0.65);
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  font-size: 14px;
}
/deep/.el-table .el-table__row .el-button--text {
  padding: 0;
  background: transparent !important;
  color: #409ffe !important;
}
.default-button-width {
  font-size: 0;
}
/deep/.el-table-column--selection .cell {
  padding-right: 10px;
}
/deep/ .el-select .el-input .el-select__caret {
  color: #909399;
}
.zhixindu-select /deep/ .el-select .el-input .el-select__caret {
  color: #c0c4cc;
}
/deep/ .el-cascader .el-input .el-icon-arrow-down {
  color: #909399;
}

.el-button {
  border-radius: 4px;
}
.img-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  .table-img {
    .image-slot,
    img {
      width: 100%;
      height: 100%;
    }
  }
}
.img-wrapper .el-image + .el-image {
  margin-left: 10px;
}
/deep/.el-table__body .cell .el-checkbox {
  padding-right: 2px;
}
.app-container {
  padding: 12px 24px;
}
/deep/.el-select .el-input.is-focus .el-input__inner,
/deep/.el-cascader .el-input .el-input__inner:focus,
/deep/.el-cascader .el-input.is-focus .el-input__inner,
/deep/.el-range-editor.is-active,
/deep/.el-range-editor.is-active:hover {
  border-color: #a9a9a9;
}
/deep/.el-input__inner {
  padding-left: 12px;
}
</style>
<style lang="scss" scoped>
@import "@/assets/styles/common/customBaseUi.scss";
</style>
<style lang="scss">
.warnTime {
  .el-date-range-picker__time-header {
    .el-date-range-picker__editors-wrap
      .el-date-range-picker__time-picker-wrap:nth-child(1) {
      z-index: -1;
    }
  }
}
</style>
